/* GUI CONVERTED from reoptr1h.p (converter v1.75) Sat Aug 12 23:07:37 2000 */
/* reoptr1h.p - VALIDATE OP, ADD WO_MSTR IF NEEDED  (REPETITIVE)         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                   */
/* All rights reserved worldwide.  This is an unpublished work.          */
/*V8:ConvertMode=Maintenance                                             */
/*K1Q4*/ /*V8:WebEnabled=No                                              */
/* REVISION: 7.3            CREATED: 04/24/96   BY: jym *G1TH*           */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan    */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb           */


/* THE PURPOSE OF THIS ROUTINE IS TO LOCK THE NEEDED INVENTORY RECORDS   */
/* IN ITEM NUMBER ORDER.  THIS WILL PREVENT THE POSSIBLITY OF A DEADLY   */
/* EMBRACE.                                                              */

         define input parameter schedule_id like wo_lot no-undo.
         define input parameter part like wo_part no-undo.
         define input parameter op like ps_op no-undo.
         define input parameter site like wo_site no-undo.
         define input parameter op_list as character no-undo.

         define variable op_char as character no-undo.

     wod_loop1:
         for each wod_det where
           wod_lot = schedule_id and
           wod_nbr = part and
           wod_part < part
           no-lock:

           op_char = string(wod_op).
           if not can-do(op_list,op_char) then next wod_loop1.

           find in_mstr exclusive-lock where
             in_part = wod_part and
             in_site = wod_site no-error.

         end.

         find in_mstr exclusive-lock where
           in_part = part and
           in_site = site no-error.

         wod_loop2:
         for each wod_det where
           wod_lot = schedule_id and
           wod_nbr = part and
           wod_part > part
           no-lock:

           op_char = string(wod_op).
           if not can-do(op_list,op_char) then next wod_loop2.

           find in_mstr exclusive-lock where
             in_part = wod_part and
             in_site = wod_site no-error.

         end.
